<template>
	<view class="page" :style="themeColor">
		<view class="flex benben-position-layout flex flex-wrap align-center result_flex_0"
			:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
			<view class='flex flex-wrap align-center justify-between flex-sub result_fd0_0'>
				<view class='flex flex-wrap align-center justify-center result_fd0_0_c0' @tap.stop="handleJumpDiy"
					data-type="back" data-url="1">
					<text class='fu-iconfont2  result_fd0_0_c0_c0'>&#xE794;</text>
				</view>
				<view class='flex flex-wrap align-stretch justify-center'>
					<text class='result_fd0_0_c1_c0'>结果</text>
				</view>
				<view class='flex flex-wrap align-center result_fd0_0_c0'>
				</view>
			</view>

		</view>
		<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
		
		<view class="loading_css" v-if="isShow">
			<u-loading size="36" color="#cd962d"></u-loading>
			<view class="loading_text">加载中</view>
		</view>
		<block v-else>
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction flex-wrap align-center benben-flex-layout result_flex_1">
				<view class='flex flex-wrap align-end self-center'>
					<text class='result_fd1_0_c0'>{{total.score}}</text>
					<text class='result_fd1_0_c1'>分</text>
				</view>
				<text class='result_fd1_1'>本次得分</text>
				<view class='flex flex-wrap align-center result_fd1_2'>
					<text class='result_fd1_2_c0'>您答对</text>
					<text class='result_fd1_2_c0'>{{total.correct_num}}</text>
					<text class='result_fd1_2_c0'>道题</text>
				</view>
			</view>
			
			<!---flex布局flex布局结束-->
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout result_flex_2">
				<view class='flex flex-wrap align-center result_fd2_0'>
					<text class='result_fd2_0_c0'>考试分析</text>
				</view>
				<view class='flex flex-wrap align-center justify-between'>
					<view class='flex flex-direction flex-wrap align-stretch result_fd2_1_c0'>
						<text class='result_fd2_1_c0_c0'>单选</text>
						<view class='flex flex-wrap align-center result_fd2_1_c0_c1'>
							<text class='result_fd2_1_c0_c1_c0'>题数：</text>
							<text class='result_fd2_1_c0_c1_c1'>{{dan.danxuan}}</text>
						</view>
						<view class='flex flex-wrap align-center result_fd2_1_c0_c1'>
							<text class='result_fd2_1_c0_c1_c0'>错误数：</text>
							<text class='result_fd2_1_c0_c2_c1'>{{dan.dan_wrong}}</text>
						</view>
						<view class='flex flex-wrap align-center result_fd2_1_c0_c1'>
							<text class='result_fd2_1_c0_c1_c0'>正确率：</text>
							<text class='result_fd2_1_c0_c1_c1'>{{dan.right}}</text>
							<text class='result_fd2_1_c0_c1_c1'>%</text>
						</view>
					</view>
					<view class='flex flex-direction flex-wrap align-stretch result_fd2_1_c0'>
						<text class='result_fd2_1_c0_c0'>多选</text>
						<view class='flex flex-wrap align-center result_fd2_1_c0_c1'>
							<text class='result_fd2_1_c0_c1_c0'>题数：</text>
							<text class='result_fd2_1_c0_c1_c1'>{{duo.duoxuan}}</text>
						</view>
						<view class='flex flex-wrap align-center result_fd2_1_c0_c1'>
							<text class='result_fd2_1_c0_c1_c0'>错误数：</text>
							<text class='result_fd2_1_c0_c2_c1'>{{duo.duo_wrong}}</text>
						</view>
						<view class='flex flex-wrap align-center result_fd2_1_c0_c1'>
							<text class='result_fd2_1_c0_c1_c0'>正确率：</text>
							<text class='result_fd2_1_c0_c1_c1'>{{duo.duo_right}}</text>
							<text class='result_fd2_1_c0_c1_c1'>%</text>
						</view>
					</view>
					<view class='flex flex-direction flex-wrap align-stretch result_fd2_1_c0'>
						<text class='result_fd2_1_c0_c0'>判断</text>
						<view class='flex flex-wrap align-center result_fd2_1_c0_c1'>
							<text class='result_fd2_1_c0_c1_c0'>题数：</text>
							<text class='result_fd2_1_c0_c1_c1'>{{pan.panduan}}</text>
						</view>
						<view class='flex flex-wrap align-center result_fd2_1_c0_c1'>
							<text class='result_fd2_1_c0_c1_c0'>错误数：</text>
							<text class='result_fd2_1_c0_c2_c1'>{{pan.pan_wrong}}</text>
						</view>
						<view class='flex flex-wrap align-center result_fd2_1_c0_c1'>
							<text class='result_fd2_1_c0_c1_c0'>正确率：</text>
							<text class='result_fd2_1_c0_c1_c1'>{{pan.pan_right}}</text>
							<text class='result_fd2_1_c0_c1_c1'>%</text>
						</view>
					</view>
				</view>
			</view>
			
			<!---flex布局flex布局结束-->
			<view class="flex flex-direction flex-wrap align-stretch benben-position-layout flex result_flex_3">
				<view class='flex flex-wrap align-center justify-between result_fd3_0'>
					<button class='result_fd3_0_c0' v-if="type == 1" @tap.stop="handleJumpDiy" data-type="back" data-url="1">返回</button>
					<button class='result_fd3_0_c0' v-else @tap.stop="viewQuestions">查看错题</button>
					<button class='result_fd3_0_c1' @tap.stop="seeAnswal">查看解析</button>
				</view>	
			</view>
		</block>
		
		
		
		<view :style="{height: '88rpx'}"></view>

	</view>
</template>
<script>
	export default {
		components: {},


		data() {
			return {
				"aid": "",  // 考试id
				"type": "",  // 1考试结束  2考试记录
				"isShow": true,
				"total": {},
				"dan": {},
				"duo": {},
				"pan": {},
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			let {
				type,
				aid
			} = options
			if (type !== undefined) this.type = type
			if (aid !== undefined) this.aid = aid;
			// this.aid = 1;
			this.getResult();
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			// 考试结果  post64b50fc705845
			getResult() {
				let url = '';
				let data = {};
				if (this.type == 1) {
					url = global.apiUrls.post64b50fc705845;
					data.examlog_id = this.aid
				} else if (this.type == 2) {
					url = global.apiUrls.post64b74ed950ea2;
					data.examlog_id = this.aid
				}
				this.$api.post(url, data).then(res => {
					// console.log(res);
					this.isShow = false;
					if (res.data.code == 1) {
						 this.total = res.data.data.total;
						 this.dan = res.data.data.dan;
						 this.duo = res.data.data.duo;
						 this.pan = res.data.data.pan;
					} else {
						this.$message.info(res.data.msg);
					}
				})
			},
			// 查看解析
			seeAnswal() {
				let aid = '';
				if (this.type == 1) {
					aid = this.total.aid;
				} else {
					aid = this.aid
				}
				uni.redirectTo({
					url: '/pages/course/trueOrFalseQuestions/trueOrFalseQuestions?aid=' + aid
				})
			},
			// 查看错题
			viewQuestions() {
				uni.redirectTo({
					url: '/pages/course/doTheQuestion/doTheQuestion?aid=' + this.aid + '&type=3'
				})
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: var(--benbenbgColor1);
		background-size: 100% auto !important;
	}

	.result_flex_0 {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.result_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333333;
		line-height: 50rpx;
	}

	.result_fd0_0_c0_c0 {
		font-size: 36rpx;
		color: #333;
	}

	.result_fd0_0_c0 {
		width: 50rpx;
		height: 50rpx;
	}

	.result_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
	}

	.result_flex_1 {
		margin: 040rpx 0rpx 0rpx 0rpx;
	}

	.result_fd1_2_c0 {
		color: #B2B2B2;
		font-size: 26rpx;
		font-weight: 400;
		line-height: 37rpx;
	}

	.result_fd1_2 {
		margin: 18rpx 0rpx 0rpx 0rpx;
	}

	.result_fd1_1 {
		color: #2A2A2A;
		font-size: 30rpx;
		font-weight: 700;
		line-height: 42rpx;
	}

	.result_fd1_0_c1 {
		color: #2A2A2A;
		font-size: 28rpx;
		font-weight: 400;
		line-height: 71rpx;
	}

	.result_fd1_0_c0 {
		color: #1577FC;
		font-size: 80rpx;
		font-weight: 700;
		line-height: 106rpx;
	}

	.result_flex_2 {
		margin: 32rpx 0rpx 0rpx 0rpx;
		padding: 0rpx 32rpx 0rpx 32rpx;
	}

	.result_fd2_1_c0_c2_c1 {
		color: #E25351;
		font-size: 36rpx;
		font-weight: 700;
		line-height: 47rpx;
	}

	.result_fd2_1_c0_c1_c1 {
		color: #2A2A2A;
		font-size: 36rpx;
		font-weight: 700;
		line-height: 47rpx;
	}

	.result_fd2_1_c0_c1_c0 {
		color: #666666;
		font-size: 26rpx;
		font-weight: 400;
		line-height: 37rpx;
	}

	.result_fd2_1_c0_c1 {
		margin: 28rpx 0rpx 0rpx 0rpx;
	}

	.result_fd2_1_c0_c0 {
		color: #333333;
		font-size: 28rpx;
		font-weight: 500;
		line-height: 40rpx;
	}

	.result_fd2_1_c0 {
		background: rgba(247, 247, 248, 0.39);
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		margin: 16rpx 0rpx 0rpx 0rpx;
		padding: 24rpx 32rpx 24rpx 32rpx;
		width: 330rpx;
	}

	.result_fd2_0_c0 {
		color: #333333;
		font-size: 32rpx;
		font-weight: 500;
		line-height: 30rpx;
	}

	.result_fd2_0 {
		margin: 0rpx 0rpx 04rpx 0rpx;
	}

	.result_flex_3 {
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		bottom: calc(24rpx + var(--window-bottom));
	}

	.result_fd3_0_c1 {
		background: rgba(205, 150, 45, 1);
		border-radius: 45rpx 45rpx 45rpx 45rpx;
		width: 320rpx;
		line-height: 88rpx;
		font-size: 32rpx;
		color: #fff;
		height: 88rpx;
	}

	.result_fd3_0_c0 {
		border: 1px solid #EEEEEE;
		border-radius: 45rpx 45rpx 45rpx 45rpx;
		width: 320rpx;
		line-height: 88rpx;
		font-size: 32rpx;
		color: rgba(51, 51, 51, 1);
		height: 88rpx;
		font-weight: 700;
	}

	.result_fd3_0 {
		height: 88rpx;
		padding: 0rpx 39rpx 0rpx 39rpx;
	}
</style>